<template>
  <view>
    <view class="margin">
      <u-gap height="20"></u-gap>
      <block v-if="address.length != 0">
        <u-cell
          @click="changeAddress(item)"
          v-for="(item, index) in address"
          :name="item.deliveryAddressId"
          :key="index"
          class="ms10 mt10"
		  :isLink="true"
          :border="false"
		  size="large"
          customStyle="background:#fff"
        >
          <view class="" slot="value">
            <view class="orderbetails-xinxi-right-hd">
              <view class="cell-text">
                {{ item.consignee || "王小二" }}
              </view>
              <view class="cell-text">
                {{ item.phone || "18475556779" }}
              </view>
            </view>
            <view class="cell-text" style="width: 600rpx">
              {{
                item.address ||
                "广东省深圳市宝安区新安街道宝安区上合岭下花园十六巷合岭下花园十六巷"
              }}
            </view>
          </view>
        </u-cell>
      </block>
      <u-empty v-else mode="data"> </u-empty>
      <!-- style="position: fixed; top: 80%; left: 50%; translate: -50% -50%;" -->
    </view>
    <view
      class="fixed w-full flex-cen"
      style="bottom: 0; background-color: white"
    >
      <view @click="addAddress" class="btn flex-cen mb-20">
        <view data-v-9e737874="" class="size_16 color_white">新增地址</view>
      </view>
    </view>
  </view>
</template>

<script>
export default {
  data() {
    return {
      address: [],
    };
  },
  onShow() {
    this.getList();
  },
  methods: {
    changeAddress(item) {
      console.log(item, "item");
      uni.navigateTo({
        url: `/pages_my/addAddress/addAddress?data=${encodeURIComponent(
          JSON.stringify(item)
        )}&change=1`,
      });
    },
    /* 获取地址 */
    async getList() {
      let re = await this.$API.addressApi.getList();
      this.address = re;
    },
    addAddress() {
      uni.navigateTo({
        url: "/pages_my/addAddress/addAddress",
      });
    },
  },
};
</script>

<style lang="scss" scoped>
page {
  background: #f8f9f9;
}

/* #ifdef MP */
.cell-text{
	font-size: 40rpx;
}
/* #endif */


 ::v-deep .u-cell__title-text--large{
	 font-size: 62rpx !important;
 }
 .u-slot-value{
	font-size: 40rpx !important;
 }

.btn {
  width: 700rpx;
  height: 100rpx;
  background: #7976e9;
  border-radius: 60rpx;
  opacity: 1;
}
::v-deep .cell-text{
	font-size: 28rpx;
}
</style>